package com.ruoyi.web.controller.douyin;


import cn.dev33.satoken.annotation.SaIgnore;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.annotation.RepeatSubmit;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.validate.AddGroup;
import com.ruoyi.common.core.validate.EditGroup;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.bo.DyPaySettingBo;
import com.ruoyi.system.domain.vo.DyPaySettingVo;
import com.ruoyi.system.service.IDyPaySettingService;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * 支付设置
 *
 * @author ruoyi
 * @date 2024-06-20
 */
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/pay/setting")
public class DyPaySettingController extends BaseController {

    private final IDyPaySettingService iDyPaySettingService;


    /**
     * 获取支付设置详细信息
     *
     * @param bo 主键
     */
    @PostMapping("/getPaySettingInfo")
    @SaIgnore
    public R<DyPaySettingVo> getPaySettingInfo(@RequestBody DyPaySettingBo bo) {
        return R.ok(iDyPaySettingService.queryById(bo));
    }

    /**
     * 新增支付设置
     */
    @Log(title = "支付设置", businessType = BusinessType.INSERT)
    @RepeatSubmit()
    @PostMapping("/addPaySetting")
    public R<Void> addPaySetting(@Validated(AddGroup.class) @RequestBody DyPaySettingBo bo) {
        return toAjax(iDyPaySettingService.insertByBo(bo));
    }

    /**
     * 修改支付设置
     */
    @Log(title = "支付设置", businessType = BusinessType.UPDATE)
    @RepeatSubmit()
    @PostMapping("/updPaySetting")
    public R<Void> updPaySetting(@Validated(EditGroup.class) @RequestBody DyPaySettingBo bo) {
        return toAjax(iDyPaySettingService.updateByBo(bo));
    }

}
